The auth-source library only has one function for external use.
Retrieve appropriate authentication tokens, determined by mode, for host host and port. If username is provided it will also be checked. If
auth-source-debugis t, debugging messages will be printed. Setauth-source-debugto a function to use that function for logging. The parameters passed will be the same that themessagefunction takes, that is, a string formatting spec and optional parameters.If mode is a list of strings, the function will return a list of strings or
nilobjects (thus you can avoid parsing the netrc file or checking the Secret Service API more than once). If it's a string, the function will return a string or anilobject. Currently only the modes “login” and “password” are recognized but more may be added in the future.host is a string containing the host name.
port contains the protocol name (e.g. “imap”) or a port number. It must be a string, corresponding to the port in the users' netrc files.
username contains the user name (e.g. “joe”) as a string.
;; IMAP example (setq auth (auth-source-user-or-password '("login" "password") "anyhostnamehere" "imap")) (nth 0 auth) ; the login name (nth 1 auth) ; the password